import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
            while(scanner.hasNext()){
                int scan= scanner.nextInt();
                int n=0;
                n++;
                func(scan,n);

            }
    }
    public static void func(int scan,int n) {
        int count = 0;
        int count2 = 0;
        int add = 0;
        while (n--!=0) {
            count = scan;
            count2 = scan;
            add = 0;
            do {

                count2 = count / 3;
                add += count2;
                count = count / 3 + count % 3;
            } while (count > 2);
            if (count == 2) {
                add += 1;
            }
            if (add == 0) {
                break;
            } else {
                System.out.println(add);
            }
        }
    }
}